package com.zy.springboot;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

class ReadLine
{
    public static void main(String[] args) throws IOException
    {
        List<String> list=new ArrayList<String>();
        InputStreamReader isr = new InputStreamReader(new FileInputStream("D:/images/txt/武侠仙侠/《九鼎记》(bookbao.cc).txt"), "GBK"); //或GB2312,GB18030
        BufferedReader fr = new BufferedReader(isr);
        //FileReader fr = new FileReader("D:/images/txt/武侠仙侠/《九鼎记》(bookbao.cc).txt");//FileReader 用于读文件
        BufferedReader br = new BufferedReader(fr);//使用缓冲区的方法将数据读入到缓冲区中
        String str;
        int i=1;
        int a=0,b=1;
        StringBuffer sql=new StringBuffer();
        while((str = br.readLine()) != null)
        {
            sql.append(str);
            System.out.println( "["+i+"]:" + str);
            if(i==a+50)   //分页(以每10个段落为一页)
            {
                list.add(sql.toString());
                sql.setLength(0);
                System.out.println("------------------------  page "+b+"  ------------------------");
                a=a+50;
                b=b+1;
            }
            i=i+1;
        }

        System.out.println("<!--------------------------------------------------------------------->");
        System.out.println(list.get(0));
        System.out.println(list.get(88));
    }
}
